import request from "../../utils/request";



enum API {
    ACCESSTOKEN = "3eae65a6-7a00-4e22-a5ec-89f1d6f701da",
    // 轮播
    SWIPER = "/promotion/ads/search/findByPosition",
    // 推荐视频
    RV = "/moment/moments/rec/default",
    CHARTS = "moment/properties/filter/original",
    // 兴趣爱好
    HOBBIES = '/avocation/avocations/rec/user?access_token=',

    // 作品
    ORIGINAL  ="/moment/moments/collect/original/",

    // 教程
    COURSE = "/moment/moments/collect/course/",
    // 专题
    SPECIALTOPIC  = "/moment/moments/collect/specialTopic/",
    // 动态
    INFORMATION = "/moment/moments/frontDynamic/default",
    // 关注
     ATTENTION = "/sns/userFollows/rec/default",

    // 兴趣爱好搜索历史
    SEARCHLIST='/searchEngine/avocationSelectedRecords/search/findByUserId?access_token=',
    // 搜索兴趣爱好
    SEARCHHOBBY = '/avocation/avocations/search/findByName?access_token=',

     //各种舞蹈
     DANCE = "/moment/moments/rec/default"


}

// ?access_token=3ce311bd-2dcd-47d6-904a-eb9b4adf4ab6&position=pc_mainpage
export const reqBanner = () => request.get(API.SWIPER, {
    params: {
        access_token: API.ACCESSTOKEN,
        position: "pc_mainpage"
    }
})

// ?access_token=&column=recommend&pageSize=20&pageNum=0&localCache=0"
// 获取视频列表
export const reqRecommendVideoList = ({ column, pageSize, pageNum, localCache }) => {

    return request.get(API.RV, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
            pageNum,
            localCache
        }
    })
}

// 获取筛选部分的数据
///?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da
export const reqChartsSelect = ()=>request.get(API.CHARTS,{
    params:{
                access_token: API.ACCESSTOKEN
    }
})

// 获取作品页列表  综合榜  
//?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da&pageSize=20&pageNum=0&column=original
export const reqOriginal = ({id, column, pageSize, pageNum,data})=>{
    return request.post(API.ORIGINAL+id,data, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
            pageNum,

        }
    })
}






let access_token = '32978a88-17bc-471b-9a89-1d13e0994564'

// 兴趣爱好
export const reqHobbies = (pageNum,pageSize) => request.get(API.HOBBIES + `${access_token}&pageNum=${pageNum}&pageSize=${pageSize}`)
// 兴趣爱好搜索历史
export const reqSearchHistory = () => request.get(API.SEARCHLIST+`${access_token}&userId=ff80808183d5a6490183e9d12ec3510d`)
// 搜索兴趣爱好
export const reqSearchHobby = (name) =>request.get(API.SEARCHHOBBY+`${access_token}&name=${name}`)
// 获取教程列表
// ?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da&pageSize=20&pageNum=0&column=course
export const reqCourse =({id, column, pageSize, pageNum,data }) => {

    return request.post(API.COURSE+id,data, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
            pageNum,
        }
    })
}

// 获取专题列表
// ?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da&pageSize=20&pageNum=0&column=specialTopic
export const reqSpecialTopic =({id, column, pageSize, pageNum,data }) => {

    return request.post(API.SPECIALTOPIC+id,data, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
            pageNum,
        }
    })
}

// ?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da&pageSize=20&column=frontDynamic
// 动态
export const reqInformation =({ column, pageSize}) => {

    return request.get(API.INFORMATION, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
        }
    })
}
// ?access_token=3eae65a6-7a00-4e22-a5ec-89f1d6f701da&pageNum=0&pageSize=8
// 关注
export const reqAttention =({ pageNum, pageSize}) => {

    return request.get(API.ATTENTION, {
        params: {
            access_token: API.ACCESSTOKEN,
            pageNum,
            pageSize,
        }
    })
}


//各种舞蹈
export const reqDance = ({ column, pageSize, pageNum, localCache }) => {

    return request.get(API.DANCE, {
        params: {
            access_token: API.ACCESSTOKEN,
            column,
            pageSize,
            pageNum,
            localCache
        }
    })
}
